package cn.wildfire.chat.kit.conversation.wallet;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.blankj.utilcode.util.ToastUtils;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import cn.wildfire.chat.kit.AppService;
import cn.wildfire.chat.kit.R;
import cn.wildfire.chat.kit.R2;
import cn.wildfire.chat.kit.entry.RedResult;

public class PassWordDialog extends Dialog {
    @BindView(R2.id.etPassword)
    EditText etPassword;
    private AppService.CustomSimpleCallback callback;
    public PassWordDialog(@NonNull Context context) {
        super(context);
    }

    public PassWordDialog(@NonNull Context context, int themeResId) {
        super(context, themeResId);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_password);
        ButterKnife.bind(this);
    }

    public void setCallback(AppService.CustomSimpleCallback callback){
        this.callback = callback;
    }
    @OnClick(R2.id.btConfirm)
    public void onConfirm(){
        String password = etPassword.getText().toString();
        if (password.length()==6) {
            callback.onUiSuccess(password);
            dismiss();
        }else {
            ToastUtils.showShort("密码错误");
        }
    }
    @OnClick(R2.id.btCancel)
    public void onCancel(){
       dismiss();
    }
}